// DownButton.cpp: implementation of the DownButton class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "DownButton.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

DownButton::DownButton()
{
	m_actionListener = NULL;
	setBackground(new AWTColor(::GetSysColor(COLOR_BTNFACE)));
	m_bPressed = false;
	addMouseListener(this);
	addMouseMotionListener(this);
}

DownButton::~DownButton()
{
	if (m_actionListener != NULL)
	{
		if (m_actionListener->isMultiCaster())
		{
#ifdef UNDER_CE
			AWTEventMulticaster* mc = (AWTEventMulticaster*)m_actionListener;
#else
			AWTEventMulticaster* mc = dynamic_cast<AWTEventMulticaster*>(m_actionListener);
#endif
			delete mc;
		}
	}
}

CSize DownButton::getMinimumSize()
{
	return getPreferredSize();
}

CSize DownButton::getPreferredSize()
{
	return CSize(16,16);
}

void DownButton::processActionEvent(AWTActionEvent* e)
{
  if (m_actionListener != NULL) 
		m_actionListener->actionPerformed(e);
}

